<?php
require_once "./db_config.php";
if(isset($_POST['id'])){
//        chop去掉最后的，
        $id=chop($_POST['id'],',');
        $state=$_POST['state'];
        $sql="UPDATE personalfiles SET state=$state WHERE 工号 in ($id)";
//        echo $sql;
        $result=mysqli_query($conn,$sql);
        if(! $result )
        {
            die('error: ' . mysqli_error($conn));
        }else{
            if(isset($_POST['outgoing'])){
                $outgoing=$_POST['outgoing'];
                $sql="UPDATE personalfiles SET outgoing=$outgoing WHERE 工号=$id";
                // echo $sql;
                $result=mysqli_query($conn,$sql);
                if(! $result )
                {
                    die('error: ' . mysqli_error($conn));
                }else{
                    echo 'success';
                }
            }else{
                echo 'success';
            }
        }
}
mysqli_close($conn);
